package br.com.news.database.entities.keys;

import javax.persistence.Embeddable;

import br.com.news.database.utils.BaseKey;

@Embeddable
public class AlternativaEnqueteKeyEntity extends BaseKey {

	private static final long serialVersionUID = 2062211891185556832L;

	private short alternativa;
	private Long idEnquete;


	public Long getIdEnquete() {
		return this.idEnquete;
	}

	public void setIdEnquete(Long idEnquete) {
		this.idEnquete = idEnquete;
	}

	public short getAlternativa() {
		return this.alternativa;
	}

	public void setAlternativa(short alternativa) {
		this.alternativa = alternativa;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + this.alternativa;
		result = prime * result
				+ ((this.idEnquete == null) ? 0 : this.idEnquete.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (!super.equals(obj))
			return false;
		if (getClass() != obj.getClass())
			return false;
		AlternativaEnqueteKeyEntity other = (AlternativaEnqueteKeyEntity) obj;
		if (this.alternativa != other.alternativa)
			return false;
		if (this.idEnquete == null) {
			if (other.idEnquete != null)
				return false;
		} else if (!this.idEnquete.equals(other.idEnquete))
			return false;
		return true;
	}

}
